<%@page import="diplom.shop.web.*"%>
<%@page import="diplom.shop.domain.*"%>
<%@page import="diplom.shop.dao.*"%>
<%@page import="diplom.shop.services.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="java.util.*"%>
<%@page import="org.hibernate.SessionFactory"%>
<%@page import="org.hibernate.Session"%>
<%@page import="org.hibernate.Transaction"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="CSS/style.css" rel="stylesheet" type="text/css" />
<title>Insert title here</title>
</head>

<body>
	<div id="body">
		<div id="contayner">
			<div id="header">
				<%
					List<ArrayList<String>> mouseForm = DomainServices.getForm(2L);
									//обробка запиту..наприклад додавання обєкту в бд...винести цю частину в сервлет
											List<String> mouseParam = new ArrayList<String>();
											
												List<String> mouseAtribute = DomainServices.getDeviceAttribute();
												mouseAtribute.addAll(DomainServices.getProcessorSpecification());
											for (String s : mouseAtribute) {
												request.setCharacterEncoding("UTF-8");
												//String[] name = request.getParameterValues(s.get(1));
												//for(String atr : name)
												if (request.getParameter(s) != null
														&& request.getParameter(s) != "") 
												{
													out.println(request.getParameter(s) + "<br>");
													mouseParam.add(request.getParameter(s));
												}
											}

											if (mouseParam != null && mouseParam.size() != 0) {
												//MouseWeb.addMouse(mouseParam);
											}
											DeviceWeb.getMouseByName("name3");
											DeviceWeb.deleteMouse("name2");

											//Device dev1 = new Mouse(new Category("categ"),"dev1name",32,32,(new ArrayList<Image>()),"buton");
											//MouseDAO mouse = new MouseDAO();
								%></div>
							</div>

							<!--<div id="left">left</div>-->
							<!--
						        <div id="right">right</div>
						        -->

							<div id="content">
								 	<table >
								 		<tr>
								<td><jsp:include page="blocks/c-left.jsp"></jsp:include></td>
								<td width="100%" ><div id="c-right">

									<form action="newDevice.jsp" method="post">
									<table>
										<tr>
										<td><label>Категорія товару</label></td>
										<td><select id="category" name="category">
										<option selected disabled value ="0">Выберите героя</option>
											<option value="DFDASD">Lola</option>
											<option value="2">Bola</option>
										</select> </td> 
										</tr>
										<tr>
										<td><label>Назва товару</label></td>
										<td><input type="text" id="deviceName"	name="deviceName" /></td> 
										</tr>
										<tr>
										<td><label>Вартість</label></td>
										<td><input type="text"	id="cost" name="cost" /></td> 
										</tr>
										<tr>
										<td><label>Гарантія</label></td>
										<td><input type="text" id="guaranty" name="guaranty" /></td> 
										</tr>
										<tr>
										<td><label>Фото</label></td>
										<td><input type="text" id="image" name="image" /></td> 
										</tr>
									 	
										<%
											for (ArrayList<String> s : mouseForm) {
				%>
						<tr>
							<td><label> <% 	out.print(s.get(0)); %> </label>
							</td><td><input id="<%out.print(s.get(1));%>" name="<%out.print(s.get(1));%>"	type="text" /></td>
						</tr>
						<%
							}
						%>
						</table>
						<input type="submit" value="Send" />
					</form>
				</div>
				</td>
				</tr>
				</table>
			</div>
			<div id="otstup"></div>
		</div>
		<div id="bot">bot</div>
	</div>
</body>
</html>